package qdu.edu.com.fushanf4.service.count.character;

import org.apache.hadoop.mapreduce.Job;
import qdu.edu.com.fushanf4.service.count.TextIntWritableCountReducer;
import qdu.edu.com.fushanf4.utils.ConfigurationUtil;
import qdu.edu.com.fushanf4.utils.DriverUtil;

import java.io.IOException;

public class ChineseCharacterCountDriver extends DriverUtil {
    public static void main(String[] args) throws IOException {
        ChineseCharacterCountDriver chineseCharacterCountDriver = new ChineseCharacterCountDriver();
        chineseCharacterCountDriver.run(args);
    }

    @Override
    public Job runJob(String[] path) throws IOException {
        Job job = ConfigurationUtil.getJob();

        // 设置Mapper和Reducer类
        job.setMapperClass(ChineseCharacterCountMapper.class);

        TextIntWritableCountReducer.setReduceOfAll(job);

        assert ConfigurationUtil.setPathAndRunJob(path, job);
        return job;
    }
}
